package memorphic.slide
{
	
	/**
	 * Captures the state of the application, or a portion of it.
	 * Extend this class to add other properties that represent state in you application
	 */
	public class StateMemento
	{
		
		public var viewStateURI:String;
		
		public var time:Date;
		
		
		public function StateMemento(viewStateURI:String)
		{
			this.viewStateURI = viewStateURI;
			time = new Date();
		}
		
		
		/**
		 * You must override this method in subclasses to perform a valid comparison 
		 * The time that the state was captured is not part of the comparison
		 */
		public function equals(other:StateMemento):Boolean
		{
			if(other == null){
				return false;
			}
			return other.viewStateURI == viewStateURI;
		}
		
		/**
		 * You must override this method in subclasses
		 */
		public function clone():StateMemento
		{
			return new StateMemento(viewStateURI);
		}
	}
}